# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=rpyc
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=5.3.0
pkgrel=1
pkgdesc='Remote Python Call - A transparent and symmetric RPC library for python (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/tomerfiliba-org/rpyc"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-plumbum")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-hatchling")
source=("https://github.com/tomerfiliba-org/rpyc/archive/${pkgver}.tar.gz")
sha256sums=('45a5d237490b6b48cad625c0f8be877d260ea35a6646d0227e1e46f868da8848')

export PYTHONHASHSEED=0

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
